<script setup>
import { ref, getCurrentInstance, defineEmits } from 'vue'
const emit = defineEmits(['ok', 'cancel'])
const ctx = getCurrentInstance()
const modelVal = ref('')

const confirm = () => {
  if (!modelVal.value) return ElMessage.error('请输入内容')
  ctx.emit('ok', { value: modelVal.value })
}
</script>

<template>
  <div>
    <div>弹窗内容</div>
    <el-input v-model="modelVal"></el-input>
    <el-button type="primary" @click="confirm">确定</el-button>
    <el-button type="primary"  @click="$emit('cancel', { name: 'cancel' })">取消</el-button>
  </div>
</template>

<style>

</style>
